import { Language } from "../../../../extend/language/Language";
import { HideEntityType } from "./HideEntityType";
import { GRadioButton } from "../../../../com/mui/controls/GRadioButton";
import { SystemSetter } from "./SystemSetter";
import { GCheckBox } from "../../../../com/mui/controls/GCheckBox";
import { RadioButtonGroup } from "../../../../fl/controls/RadioButtonGroup";
import { ObjCreate } from "../common/ObjCreate";
import { ALL } from "../../../../HideEntityType/ALL";
import { Friendly } from "../../../../HideEntityType/Friendly";
import { Enemy } from "../../../../HideEntityType/Enemy";
type int = number;
//class EntityHideSetterItem
    
    export  class EntityHideSetterItem /* flash.display.Sprite */
    {
        constructor()
        {
            this._dataArr = [{"name": Language.getString(33020), "value": ALL}, {"name": Language.getString(33021), "value": Friendly}, {"name": Language.getString(33022), "value": Enemy}];
            this._btnDic = new Map<any, any> /* flash.utils.Dictionary */();
            
            this.init();
            return;
        }

        public get entityHideSetting(): int
        {
            return this._entityHideSetting;
        }

        public set entityHideSetting(arg1: int)
        {
            this._entityHideSetting = arg1;
            var loc1=this._btnDic[arg1] as GRadioButton;
            if (loc1) 
            {
                loc1.selected = true;
            }
            this._itemCb.selected = SystemSetter.localSetter.hideNearPlayerPet;
            return;
        }

        /* internal  */init(): void
        {
            var loc2=null;
            this._itemCb = new GCheckBox();
            this._itemCb.styleName = "GCheckBox";
            this._itemCb.name = "hideNearPlayerPet";
            this._itemCb.label = Language.getString(33023);
            this._itemCb.width = 200;
            this._itemCb.selected = false;
            this._itemCb.buttonMode = true;
            this._itemCb.addEventListener(flash.events.Event.CHANGE, this.onItemCbChangeHandler);
            addChild(this._itemCb);
            var loc1=new RadioButtonGroup("rbg");
            var loc3=20;
            var loc4=15;
            var loc5=0;
            while (loc5 < this._dataArr.length) 
            {
                loc2 = ObjCreate.createRadioButton(this._dataArr[loc5].name, loc3, loc4, 80, 30, this, "GRadioButton");
                loc2.addEventListener(flash.events.MouseEvent.CLICK, this.onRadioBtnClickHandler);
                loc2.value = this._dataArr[loc5].value;
                loc2.group = loc1;
                loc2.width = 200;
                loc4 = loc4 + 20;
                this._btnDic[this._dataArr[loc5].value] = loc2;
                ++loc5;
            }
            return;
        }

        /* internal  */onRadioBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target as GRadioButton;
            this._entityHideSetting = loc1.value as int;
            SystemSetter.localSetter.isAlter = true;
            SystemSetter.localSetter.hidePlayerPetType = this._entityHideSetting;
            return;
        }

        /* internal  */onItemCbChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            SystemSetter.localSetter.isAlter = true;
            SystemSetter.localSetter.setSystemInfo(this._itemCb.name, this._itemCb.selected);
            return;
        }

        /* internal */ /* var */_dataArr: Array<any>;

        /* internal */ /* var */_btnDic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_itemCb: GCheckBox;

        /* internal */ /* var */_entityHideSetting: int;
    }
